package com.glory.hikvisionmobile.customView;

import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;

/**
 * *****************************
 *
 * @Anthor yazhou
 * @Email 1184545990@qq.com
 * @Time 2020/3/31 19:22
 * @DESC *****************************
 */
public class HikGestureDetector {

    private GestureDetector mGestureDetector;
    private ScaleGestureDetector mScaleGestureDetector;

    public HikGestureDetector(Context context, GestureDetector.OnGestureListener onGestureListener, ScaleGestureDetector.OnScaleGestureListener onScaleGestureListener) {
        mGestureDetector = new GestureDetector(context, onGestureListener);
        mScaleGestureDetector = new ScaleGestureDetector(context, onScaleGestureListener);
    }

    public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleTapListener) {
        mGestureDetector.setOnDoubleTapListener(onDoubleTapListener);
    }

    public boolean onTouchEvent(MotionEvent event){
        boolean handled = mGestureDetector.onTouchEvent(event)|mScaleGestureDetector.onTouchEvent(event);
        return handled;
    }
}
